<?php

declare (strict_types=1);
namespace App\Model;

use Hyperf\Database\Model\SoftDeletes;
/**
 * @property int $id id
 * @property int $mid 机构ID
 * @property int $uid 关联员工
 * @property string $signin_time 考勤时间
 * @property int $signin_status 考勤状态1签到、2签退、3迟到、4早退、5请假
 * @property string $signin_address 考勤地址
 * @property int $sort 排序字段
 * @property int $status 状态
 * @property int $created_user 创建者类型
 * @property string $remark 备注
 * @property \Carbon\Carbon $created_at 创建时间
 * @property \Carbon\Carbon $updated_at 更新时间
 * @property string $deleted_at 软删除字段
 */
class AttendanceRecord extends BaseModel
{
    use SoftDeletes;
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'attendance_records';

    protected $hidden = ['deleted_at'];
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['id', 'mid', 'uid', 'signin_time', 'signin_status', 'signin_address', 'sort', 'status', 'created_user', 'remark', 'created_at', 'updated_at', 'deleted_at'];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'int', 'mid' => 'integer', 'uid' => 'integer', 'signin_status' => 'integer', 'sort' => 'integer', 'status' => 'integer', 'created_user' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
    /**
     * [attuser 考勤用户]
     * @return [type] [description]
     */
    public function attuser()
    {
        return $this->hasOne(User::class, 'id', 'uid');
    }
    /**
     * [createuser 创建者]
     * @return [type] [description]
     */
    public function createuser()
    {
        return $this->hasOne(User::class, 'id', 'created_user');
    }
}